<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>修改密码</title>
</head>
<style>
    .content{
        margin-top: 100px;
        margin-left: 300px;
    }
</style>
<body>
<div class="content">
    <form method="post" action="{% url 'users:alterpassword' %}">
        <label>新的密码：</label><input type="password" name="password1" id="pwd1"><br>
        <label>确认密码：</label><input type="password" name="password2" id="pwd2"><br>
        <input type="submit" value="更改密码" onclick="return sub()">
        {% csrf_token %}
    </form>
</div>
<script>
    var pwd1 = $("#pwd1");
    var pwd2 = $("#pwd2");

    function sub() {
        if(pwd1 == pwd2){
            return true;
        }else {
            alert("密码不一致");
            return false;
        }
    }

</script>
</body>
</html>